<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>列表</title>
    <link rel="stylesheet" type="text/css" href="../static/css/style.css">
    <style>
        table {
            border-collapse: collapse;
            width: 100%;
        }

        table, th, td {
            border: 1px solid #ddd;
        }

        th, td {
            padding: 8px;
            text-align: left;
        }

        tr:nth-child(even) {
            background-color: #f2f2f2;
        }
    </style>
</head>
<body>
    <span th:if="${session.role == 'manager'}">
        <a th:href="@{/userList}">用户列表</a>
    </span>
    <span th:if="${session.role != 'manager'}">
        <p style="color: red;">您没有权限访问该页面</p>
    </span>
    <table class="hovertable">
        <tr>
            <th>序号</th>
            <th>用户姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>出生日期</th>
            <th>角色</th>
        </tr>
        <tr th:each="userItem,num : ${userList}">
            <td th:text="${num.count}"></td>
            <td th:text="${userItem.username}"></td>
            <td th:text="${userItem.sex}"></td>
            <td th:text="${userItem.age}"></td>
            <td th:text="${userItem.birthDate}"></td>
            <td th:text="${userItem.role}"></td>
        </tr>
    </table>
</body>
</html>